﻿using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

namespace com.IronOne.BoardPACWinAppBO.Agenda
{
    public class MemberModel : ObservableObject
    {
        //public string ProfilePicPath { get; set; }

        //public string ListItemBgColor { get; set; }
        /// <summary>
        ///     The <see cref="ListItemBgColor" /> property's name.
        /// </summary>
        public const string ListItemBgColorPropertyName = "ListItemBgColor";

        //public string IndividualParticipationStatus { get; set; }

        /// <summary>
        ///     The <see cref="IndividualParticipationStatus" /> property's name.
        /// </summary>
        public const string IndividualParticipationStatusPropertyName = "IndividualParticipationStatus";

        /// <summary>
        ///     The <see cref="ProfilePicPath" /> property's name.
        /// </summary>
        public const string ProfilePicPathPropertyName = "ProfilePicPath";

        /// <summary>
        ///     The <see cref="ListItemIndex" /> property's name.
        /// </summary>
        public const string ListItemIndexPropertyName = "ListItemIndex";

        //public Visibility IsParticipationBtnVisible { get; set; }

        /// <summary>
        ///     The <see cref="IsParticipationBtnVisible" /> property's name.
        /// </summary>
        public const string IsParticipationBtnVisiblePropertyName = "IsParticipationBtnVisible";

        /// <summary>
        ///     The <see cref="IsMemberSelected" /> property's name.
        /// </summary>
        public const string IsMemberSelectedPropertyName = "IsMemberSelected";

        private string _individualParticipationStatus = "";
        private bool _isMemberSelected = true;
        private Visibility _isParticipationBtnVisible;
        private string _listItemBgColor = "Transparent";
        private int _listItemIndex;
        private RelayCommand<Object> _listViewItemClicked;
        private BitmapImage _profilePicPath;

        public MemberModel()
        {
            //Must be Collapsed.
            IsSyncInProgressRing = Visibility.Collapsed;
            IsParticipationBtnVisible = Visibility.Visible;
            IsMemberSelected = false;
        }

        public int MemberId { get; set; }
        public string FullName { get; set; }
        public string CompanyName { get; set; }
        public string Address1 { get; set; }
        public string Address2 { get; set; }
        public string ContactNo { get; set; }
        public string EmailId { get; set; }
        public string TimeStamp { get; set; }
        public string Info { get; set; }
        public DateTime? LastUpadatedDateTime { get; set; }
        public string IPadDisplayName { get; set; }
        public int AttendanceStatus { get; set; }
        public string StatusText { get; set; }

        /// <summary>
        ///     Sets and gets the ListItemBgColor property.
        ///     Changes to that property's value raise the PropertyChanged event.
        /// </summary>
        public string ListItemBgColor
        {
            get { return _listItemBgColor; }

            set
            {
                if (_listItemBgColor == value)
                {
                    return;
                }

                _listItemBgColor = value;
                RaisePropertyChanged(ListItemBgColorPropertyName);
            }
        }

        /// <summary>
        ///     Sets and gets the IndividualParticipationStatus property.
        ///     Changes to that property's value raise the PropertyChanged event.
        /// </summary>
        public string IndividualParticipationStatus
        {
            get { return _individualParticipationStatus; }

            set
            {
                if (_individualParticipationStatus == value)
                {
                    return;
                }

                _individualParticipationStatus = value;
                RaisePropertyChanged(IndividualParticipationStatusPropertyName);
            }
        }

        /// <summary>
        ///     Sets and gets the ProfilePicPath property.
        ///     Changes to that property's value raise the PropertyChanged event.
        /// </summary>
        public BitmapImage ProfilePicPath
        {
            get { return _profilePicPath; }

            set
            {
                if (_profilePicPath == value)
                {
                    return;
                }

                _profilePicPath = value;
                RaisePropertyChanged(ProfilePicPathPropertyName);
            }
        }

        public SolidColorBrush StatusColorCode { get; set; }

        /// <summary>
        ///     Sets and gets the ListItemIndex property.
        ///     Changes to that property's value raise the PropertyChanged event.
        /// </summary>
        public int ListItemIndex
        {
            get { return _listItemIndex; }

            set
            {
                if (_listItemIndex == value)
                {
                    return;
                }

                _listItemIndex = value;
                RaisePropertyChanged(ListItemIndexPropertyName);
            }
        }

        public Visibility IsSyncInProgressRing { get; set; }
        public int IsActive { get; set; }

        /// <summary>
        ///     Sets and gets the IsParticipationBtnVisible property.
        ///     Changes to that property's value raise the PropertyChanged event.
        /// </summary>
        public Visibility IsParticipationBtnVisible
        {
            get { return _isParticipationBtnVisible; }

            set
            {
                if (_isParticipationBtnVisible == value)
                {
                    return;
                }

                _isParticipationBtnVisible = value;
                RaisePropertyChanged(IsParticipationBtnVisiblePropertyName);
            }
        }

        /// <summary>
        ///     Sets and gets the IsMemberSelected property.
        ///     Changes to that property's value raise the PropertyChanged event.
        /// </summary>
        public bool IsMemberSelected
        {
            get { return _isMemberSelected; }

            set
            {
                if (_isMemberSelected == value)
                {
                    return;
                }

                _isMemberSelected = value;
                RaisePropertyChanged(IsMemberSelectedPropertyName);
            }
        }

        /// <summary>
        ///     Gets the MyCommand.
        /// </summary>
        public RelayCommand<Object> ListViewItemClicked
        {
            get
            {
                return _listViewItemClicked
                       ?? (_listViewItemClicked = new RelayCommand<Object>(
                           item => { }));
            }
        }

        public int PaperApprovalStatus { get; set; }
        public string PaperApprovalStatusDisplay { get; set; }
        public Visibility IsPaperApprovalCommentAvilable { get; set; }
        public string PaperApprovalComment { get; set; }
        public string PaperApprovalStatusTextColor { get; set; }
    }
}